* be truncated, edited, or otherwise trimmed should be done on the
* way to the target.
*/
-#if NEW_STRINGS
-// Pretty much every occurrence of CSTRc() in the code should be treated
-// as a TODO. 90% of them are variadic functions (warning, gbfprint, fatal)
-// that should really support stream operators.
-
-#undef CSTRc
-#define CSTRc(s) s.s_
-
-class String {
- public:
- String() :
- s_(NULL) {}
-
- bool isEmpty() const {
- return !(s_ && *s_);
- }
-
- // Support things that expect a pointer. Almost all of these will
- // ultimately go away, e.g. xfree(shortname);
-#if 1
- operator char*() const {
- return s_;
- }
-#endif
- // Support shortname = foo;
-#if 1
- char* operator=(char* s) {
- s_ = s;
- return s_;
- }
-#endif
-
- // If something is expecting a QString already, just let them have one.
- operator QString() const {
- return s_;
- }
-
- char* s_;
-};
-
+#if NEW_STRINGS
+ typedef QString String;
+ #define CSTRc(qstr) (qstr.toLatin1().constData())
#else
-#define CSTRc(qstr) (qstr)
- typedef char* String;
+ #define CSTRc(qstr) (qstr)
+ typedef char* String;
#endif
class waypoint
const QString& url_link_text);
void xcsv_setup_internal_style(const char* style_buf);
void xcsv_read_internal_style(const char* style_buf);
-waypoint* find_waypt_by_name(const char* name);
+waypoint* find_waypt_by_name(const QString& name);
void waypt_backup(signed int* count, queue** head_bak);
void waypt_restore(signed int count, queue* head_bak);
#ifndef DEBUG_MEM
char* mkshort(short_handle, const char*);
+char* mkshort(short_handle, const QString&);
short_handle mkshort_new_handle(void);
#else
char* MKSHORT(short_handle, const char*, DEBUG_PARAMS);
xfree(qs);
return rv;
}
-#if NEW_STRINGS
-int
-gbfputs(const String& s, gbfile* file)
-{
- return gbfwrite(s.s_, 1, strlen(s.s_), file);
-}
-#endif
/*
* gbfwrite: (as fwrite)
return gbfputcstr(qPrintable(s), file);
}
-#if NEW_STRINGS
-int
-gbfputcstr(const String& s, gbfile* file)
-{
- return gbfputcstr(s.s_, file);
-}
-#endif
-
/*
* gbfputcstr: write a pascal string into a stream
* return the number of written characters
return r;
}
-#if NEW_STRINGS
-int
-gbfputpstr(const String& s, gbfile* file)
-{
- return gbfputpstr(s.s_, file);
-}
-#endif
-
/* Much more higher level functions */
gbsize_t
int gbfputc(int c, gbfile* file);
int gbfputs(const char* s, gbfile* file);
int gbfputs(const QString& s, gbfile* file);
-#if NEW_STRINGS
-class String;
-int gbfputs(const String& s, gbfile* file);
+#if NEW_STRINGS
+typedef QString String;
#endif
int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file);
int gbfflush(gbfile* file);
int gbfputcstr(const char* s, gbfile* file); // write string including '\0'
int gbfputcstr(const QString& s, gbfile* file); // write string including '\0'
-#if NEW_STRINGS
-int gbfputcstr(const String& s, gbfile* file); // write string including '\0'
-#endif
int gbfputpstr(const char* s, gbfile* file); // write as pascal string
int gbfputpstr(const QString& s, gbfile* file); // write as pascal string
-#if NEW_STRINGS
-int gbfputpstr(const String& s, gbfile* file); // write as pascal string
-#endif
gbsize_t gbfcopyfrom(gbfile* file, gbfile* src, gbsize_t count);